package com.xxx.dict.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxx.dict.domain.Dict;
import com.xxx.dict.mapper.DictMapper;
import com.xxx.dict.query.DictQuery;
import com.xxx.dict.service.IDictService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class DictServiceImpl implements IDictService {

    private final DictMapper dictMapper;

    @Override
    public Dict findOne(Long id) {
        return dictMapper.findOne(id);
    }

    @Override
    public List<Dict> findAll() {
        return dictMapper.findAll();
    }

    @Override
    public List<Dict> queryPage(DictQuery dictQuery) {
        PageHelper.startPage(dictQuery.getCurrentPage(), dictQuery.getPageSize());
        return dictMapper.queryPage(dictQuery);
    }

    @Override
    public void addDict(Dict dict) {
        dictMapper.addDict(dict);
    }

    @Override
    public void updateDict(Dict dict) {
        dictMapper.updateDict(dict);
    }

    @Override
    public void deleteDict(Long id) {
        dictMapper.deleteDict(id);
    }

    @Override
    public void batchDict(Long[] ids) {
        dictMapper.batchDict(ids);
    }
}
